home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14424 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.9 KB  |  93 lines

  1. Newsgroups: comp.lang.c
  2. Path: mvb.saic.com!eskimo!scs
  3. From: scs@eskimo.com (Steve Summit)
  4. Subject: Re: 16bit vs. 32bit
  5. X-Nntp-Posting-Host: eskimo.com
  6. Message-ID: <Dpv9Co.4M0@eskimo.com>
  7. Sender: news@eskimo.com (News User Id)
  8. Organization: schmorganization
  9. References: <315C1210.5621@oc.com> <DpAvC8.HD4@eskimo.com> <4kk16j$9jt@newsie.dmc.com>
  10. Date: Sun, 14 Apr 1996 19:12:23 GMT
  11.  
  12. In article <4kk16j$9jt@newsie.dmc.com>, prozac@cape.com
  13. (gregg jennings) writes:
  14. > In article <DpAvC8.HD4@eskimo.com> scs@eskimo.com (Steve Summit) writes:
  15. >> [I and others had written:]
  16. >>>>> ...If you find yourself needing to
  17. >>>>> know the sizes of things in bits, someone screwed up.
  18. >>>>
  19. >>>> Yeah. Maybe it was the guy who wrote the program in a 32-bit Unix 
  20. >>>> machine seven years back that stores data in binary format to a file 
  21. >>>> you now have to read in a 16-bit DOS machine?
  22. >> 
  23. >> Indeed.
  24. >>
  25. >>> And, how did that programmer "screw up" ?
  26. >> 
  27. >> By choosing a binary data file format, and condemning later
  28. >> programmers to use machine-dependent code if they wished to read
  29. >> it efficiently.
  30. > You are right but...
  31. > In data compression, for example, one just has to know the size of
  32. > things in bits!
  33.  
  34. You are right, but I believe it is possible to write portable
  35. compression programs and to design portable compressed formats.
  36. (Certainly, my statement that "If you find yourself needing to
  37. know the sizes of things in bits, someone screwed up" was an
  38. oversimplification.)
  39.  
  40. > Yes using a non-arbitrary data file format make sense, especially
  41. > for common applications such as word processors (microsoft take
  42. > note please!), but there may always be some situations where
  43. > portability of data formats is just not required.
  44. > Choosing a data format as you indicate implies pre-cognition:
  45. >    1. You knew that a higher-bit system was going to appear in
  46. >       the future (we all think that now, but many years ago?).
  47. >    2. You knew that the data was not going to be limited to one
  48. >       machine/implementation...
  49.  
  50. Look at it this way.  I advocate using portable (preferably
  51. text-based) data file formats whenever possible.  You may
  52. disagree, but let's think about person #3, who wrote some data
  53. with a 32-bit Unix machine seven years back, and person #4, who
  54. now has to read it with a 16-bit DOS machine.  Which of us does
  55. person #4 wish that person #3 had listened to?  (For that matter,
  56. which of us do you wish Microsoft had listened to?)
  57.  
  58. > Also, like moving up in bit size, whose to say that ASCII will be
  59. > portable forever?  (Although in all probability it just might.)
  60.  
  61. ASCII text is so ubiquitous that it's reasonable to assume that
  62. there will always be easy ways either to read it directly, or
  63. to convert it transparently (that is, without knowing anything
  64. about its structure) into a format that can be read.
  65.  
  66. > How about writing something that is called a data conversion program?
  67.  
  68. I've written those, yup.  The more of them I have to write and
  69. maintain, the bigger a nuisance it is.  It's an especial nuisance
  70. to have to write single-purpose ones, for converting one
  71. particular needlessly-specific format into another.
  72.  
  73. > And just how is Unix data converted to DOS?  9" tape?  Floppies?
  74. > Serial/network connection?  All require a data conversion program
  75. > of some type (either an application/tool or some transfer protocol).
  76.  
  77. In most cases, it's reasonable to treat any of these media
  78. as streams of bytes (either text or binary), so writing to
  79. or reading from them can be done with general-purpose tools,
  80. independent of the structure of the data.  (There are of course
  81. a few things to worry about.  You often have to specify a record
  82. size with magnetic media, and different media and different
  83. operating systems of course use different end-of-line
  84. representations for text files.  If you handle end-of-line
  85. translations appropriately in the general-purpose transfer
  86. tools, though, individual applications don't need to care.)
  87.  
  88.                     Steve Summit
  89.                     scs@eskimo.com
  90.